import { _decorator, Component, Enum, Node } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('CardInfo')
export class CardInfo extends Component {
    //花型
    CardSuit = Enum ({
        none: 0,
        spade: 1,  //黑桃
        heart: 2,  //红心
        club: 3,   //梅花
        diamond: 4,//方块
    });

    //数字
     CardNumber = Enum ({
        none: 0,
        num_3: 3,
        num_4: 4,
        num_5: 5,
        num_6: 6,
        num_7: 7,
        num_8: 8,
        num_9: 9,
        num_10: 10,
        num_J: 11,
        num_Q: 12,
        num_K: 13,
        num_A: 14,
        num_2: 15,
        littleJoker: 16,
        bigJoker: 17,
    });

    num : number = this.CardNumber.none;
    cardSuit : number = this.CardNumber.none;

    CardInfo(): string {
    
        //主要用于打印时，能清晰看到现在是哪张牌
        var desc = "string";
        
        if (this.num == this.CardNumber.littleJoker) {
            return "小王";
        }
        if (this.num == this.CardNumber.bigJoker) {
            return "大王";
        }

        switch(this.cardSuit) {
            case this.CardSuit.heart:
                desc = "红桃";
                break;
            case this.CardSuit.spade:
                desc = "黑桃";
                break;
            case this.CardSuit.club:
                desc = "梅花";
                break;
            case this.CardSuit.diamond:
                desc = "方块";
                break;
        }

        switch(this.num) {
            case this.CardNumber.num_3:
                desc += "3";
                break;
            case this.CardNumber.num_4:
                desc += "4";
                break;
            case this.CardNumber.num_5:
                desc += "5";
                break;
            case this.CardNumber.num_6:
                desc += "6";
                break;
            case this.CardNumber.num_7:
                desc += "7";
                break;
            case this.CardNumber.num_8:
                desc += "8";
                break;
            case this.CardNumber.num_9:
                desc += "9";
                break;
            case this.CardNumber.num_10:
                desc += "10";
                break;
            case this.CardNumber.num_J:
                desc += "J";
                break;
            case this.CardNumber.num_Q:
                desc += "Q";
                break;
            case this.CardNumber.num_K:
                desc += "K";
                break;
            case this.CardNumber.num_A:
                desc += "A";
                break;
            case this.CardNumber.num_2:
                desc += "2";
                break;
        }
       
        return desc;
    }

}


